<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.01.
   家居公司分类模型($$)*/

!defined('Q_PATH') && exit;

class JiajucompanyclassModel extends CommonModel{

	static public function init__(){
		return array(
			'table_name'=>'jiajucompanyclass',
			'check'=>array(
				'jiajucompanyclass_name'=>array(
					array('require',Q::L('分类属性不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('max_length',32,Q::L('分类属性不能超过32个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
			),
		);
	}

	static function F(){
		$arrArgs=func_get_args();
		return ModelMeta::instance(__CLASS__)->findByArgs($arrArgs);
	}

	static function M(){
		return ModelMeta::instance(__CLASS__);
	}

	protected function beforeSave_(){
		$this->jiajucompanyclass_name=C::text($this->jiajucompanyclass_name);
	}

	public function getClass($nType){
		return self::F('jiajucompanyclass_parentid=? AND jiajucompanyclass_status=1',$nType)
			->order('jiajucompanyclass_sort ASC')
			->setColumns('jiajucompanyclass_id,jiajucompanyclass_name')
			->asArray()
			->getAll();
	}

}
